package vistas.clientes;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JSeparator;
import javax.swing.JTextField;

import javax.swing.WindowConstants;
import javax.swing.SwingUtilities;

import app.Odv;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class AltaFrame extends javax.swing.JFrame {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private JLabel jLabelRazonSocial;
	private JLabel jLabelTelefono;
	private JTextField jTextFieldCuil;
	private JLabel jLabel1;
	private JTextField jTextFieldTelefono;
	private JButton jButton1;
	private JButton jButtonSalir;
	private JButton jButtonGuardar;
	private JSeparator jSeparator2;
	private JSeparator jSeparator1;
	private JTextField jTextFieldPiso;
	private JLabel jLabelPiso;
	private JTextField jTextFieldDepartamento;
	private JLabel jLabelDepartamento;
	private JTextField jTextFieldLocalidad;
	private JLabel jLabelLocalidad;
	private JTextField jTextFieldNumero;
	private JLabel jLabelNumero;
	private JTextField jTextFieldCalle;
	private JLabel jLabelCalle;
	private JTextField jTextFieldRazonSocial;

	/**
	* Auto-generated main method to display this JFrame
	*/
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				AltaFrame inst = new AltaFrame();
				inst.setLocationRelativeTo(null);
				inst.setVisible(true);
			}
		});
	}
	
	public AltaFrame() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			getContentPane().setLayout(null);
			{
				jLabelRazonSocial = new JLabel();
				getContentPane().add(jLabelRazonSocial);
				jLabelRazonSocial.setText("RAZON SOCIAL : ");
				jLabelRazonSocial.setBounds(12, 72, 115, 16);
			}
			{
				jTextFieldRazonSocial = new JTextField();
				getContentPane().add(jTextFieldRazonSocial);
				jTextFieldRazonSocial.setBounds(150, 65, 154, 23);
			}
			{
				jLabelCalle = new JLabel();
				getContentPane().add(jLabelCalle);
				jLabelCalle.setText("CALLE:");
				jLabelCalle.setBounds(12, 119, 55, 16);
			}
			{
				jTextFieldCalle = new JTextField();
				getContentPane().add(jTextFieldCalle);
				jTextFieldCalle.setBounds(150, 112, 154, 23);
			}
			{
				jLabelNumero = new JLabel();
				getContentPane().add(jLabelNumero);
				jLabelNumero.setText("NUMERO : ");
				jLabelNumero.setBounds(12, 165, 92, 16);
			}
			{
				jTextFieldNumero = new JTextField();
				getContentPane().add(jTextFieldNumero);
				jTextFieldNumero.setBounds(150, 162, 154, 23);
			}
			{
				jLabelLocalidad = new JLabel();
				getContentPane().add(jLabelLocalidad);
				jLabelLocalidad.setText("LOCALIDAD :");
				jLabelLocalidad.setBounds(12, 257, 110, 16);
			}
			{
				jTextFieldLocalidad = new JTextField();
				getContentPane().add(jTextFieldLocalidad);
				jTextFieldLocalidad.setBounds(150, 254, 154, 23);
			}
			{
				jLabelDepartamento = new JLabel();
				getContentPane().add(jLabelDepartamento);
				jLabelDepartamento.setText("DEPARTAMENTO :");
				jLabelDepartamento.setBounds(12, 299, 110, 16);
			}
			{
				jTextFieldDepartamento = new JTextField();
				getContentPane().add(jTextFieldDepartamento);
				jTextFieldDepartamento.setBounds(150, 296, 154, 23);
			}
			{
				jLabelPiso = new JLabel();
				getContentPane().add(jLabelPiso);
				jLabelPiso.setText("PISO : ");
				jLabelPiso.setBounds(12, 344, 99, 16);
			}
			{
				jTextFieldPiso = new JTextField();
				getContentPane().add(jTextFieldPiso);
				jTextFieldPiso.setBounds(150, 337, 154, 23);
			}
			{
				jSeparator1 = new JSeparator();
				getContentPane().add(jSeparator1);
				jSeparator1.setBounds(178, 396, 9, -21);
			}
			{
				jSeparator2 = new JSeparator();
				getContentPane().add(jSeparator2);
				jSeparator2.setBounds(0, 396, 471, 10);
			}
			{
				jButtonGuardar = new JButton();
				getContentPane().add(jButtonGuardar);
				jButtonGuardar.setText("GUARDAR");
				jButtonGuardar.setBounds(80, 436, 98, 25);
				jButtonGuardar.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {
						System.out.println("jButtonGuardar.actionPerformed, event="+evt);
						
						
						Odv s = Odv.getinstancia();
						
						// TODO
						s.agregarCliente(jTextFieldCuil.getText(),jTextFieldRazonSocial.getText(), jTextFieldTelefono.getText(), jTextFieldCalle.getText(), jTextFieldNumero.getText(), jTextFieldPiso.getText(), jTextFieldDepartamento.getText(), jTextFieldLocalidad.getText());
						
						/*luego de guardar se vuelven a limpiar los datos*/
						
						jTextFieldCalle.setText("");
						jTextFieldDepartamento.setText("");
						jTextFieldLocalidad.setText("");
						jTextFieldNumero.setText("");
						jTextFieldPiso.setText("");
						jTextFieldRazonSocial.setText("");
						jTextFieldTelefono.setText("");
						jTextFieldCuil.setText("");
						
						NumeroClienteFrame v=new NumeroClienteFrame();
						v.setLocationRelativeTo(null);
						v.setVisible(true);
						
						
					}
				});
			}
			{
				jButtonSalir = new JButton();
				getContentPane().add(jButtonSalir);
				jButtonSalir.setText("SALIR");
				jButtonSalir.setBounds(248, 436, 85, 25);
				jButtonSalir.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {
						System.out.println("jButtonSalir.actionPerformed, event="+evt);
						dispose();
					}
				});
			}
			{
				jButton1 = new JButton();
				getContentPane().add(jButton1);
				jButton1.setText("BORRAR");
				jButton1.setBounds(354, 165, 106, 39);
				jButton1.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {
						System.out.println("jButton1.actionPerformed, event="+evt);
						jTextFieldCalle.setText("");
						jTextFieldDepartamento.setText("");
						jTextFieldLocalidad.setText("");
						jTextFieldNumero.setText("");
						jTextFieldPiso.setText("");
						jTextFieldRazonSocial.setText("");
						jTextFieldCuil.setText("");
					}
				});
			}
			{
				jLabelTelefono = new JLabel();
				getContentPane().add(jLabelTelefono);
				jLabelTelefono.setText("TELEFONO : ");
				jLabelTelefono.setBounds(12, 210, 81, 16);
			}
			{
				jTextFieldTelefono = new JTextField();
				getContentPane().add(jTextFieldTelefono);
				jTextFieldTelefono.setBounds(150, 207, 154, 23);
			}
			{
				jLabel1 = new JLabel();
				getContentPane().add(jLabel1);
				jLabel1.setText("CUIL: ");
				jLabel1.setBounds(12, 24, 81, 16);
			}
			{
				jTextFieldCuil = new JTextField();
				getContentPane().add(jTextFieldCuil);
				jTextFieldCuil.setBounds(150, 21, 154, 23);
			}
			pack();
			this.setSize(487, 541);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}

}
